<template>
    <div>
       <table>
          <thead>
            <tr>
                <td>用户名</td>
                <td><input type="text" v-model="Aeg.name" ></td>
            </tr>

            <tr>
                <td>密码</td>
                <td><input type="password" v-model="Aeg.pwd" ></td>
            </tr>

            <tr>
                <td></td>
                <td><input type="button" value="登录" @click="Show"></td>
            </tr>
          </thead>
       </table>
    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref } from 'vue';

let Aeg:any=ref({
    name:'',
    pwd:'',
});
const Show=()=>{
    if(Aeg.value.name=="")
{
    alert("用户名不为空");
    return;
}
    if(Aeg.value.pwd=="" )
{
    alert("密码不为空");
    return;
}
    axios({
        url:'https://localhost:7033/api/User/Login',
        method:'post',
        params:Aeg.value
    })
    .then((res)=>{
        console.log(res);
    
        if(res.data==-1)
    {
        alert("用户名有误");
        return;
    }
    if(res.data==-2)
    {
        alert("密码有误");
        return;
    }
    if(res.data==-3)
    {
        alert("账号被冻结");
        return;
    }
    if(res.data>0)
    {
        alert("成功");
    }
    })
}


</script>

<style scoped>

</style>